﻿using System;

namespace DataAccess
{
    public class UnitOfWork : IUnitOfWork
    {
        private DB _context;

        public UnitOfWork()
        {
            _context = new DB();
        }
        public void Dispose()
        {
            _context.Dispose();
        }

        public DB DBContext
        {
            get { return _context; }
        }
        public int SaveChanges()
        {
            return _context.SaveChanges();
        }
    }
    public interface IUnitOfWork : IDisposable
    {
        DB DBContext { get; }
        int SaveChanges();
    }
}
